<template>
  <div class="message">
    <div v-show="flag" class="alert">
      {{ title }}
    </div>
    <div class="dui" v-show="imgflag">
      <img src="../../assets/image/dui.webp" alt="">
    </div>
  </div>
</template>
<script>
export default ({
  props: {
    title: { type: String, default: '登陆成功' },
    flag: { type: Boolean, default: false, },
    imgflag: { type: Boolean, default: false, },
  },
  watch: {
    flag(newl, old) {
      if (newl) {
        setTimeout(() => {
          this.$emit('update:flag', false)
        }, 1000);
      }
    }
  }
})
</script>
<style lang="scss" scoped>
.message {
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 102;

  .dui {
    img {
      width: 50px;
    }
  }

  .alert {
    width: 40%;
    height: 30px;
    position: absolute;
    border-radius: 5px;
    font-size: 12px;
    top: 0;
    margin-top: 90%;
    margin-left: 30%;
    left: 0;
    line-height: 30px;
    background-color: rgba(0, 0, 0, 0.7);
    text-align: center;
    color: #fff;
  }
}
</style>